package com.atguigu.gulimall.es.entity;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
import java.util.List;

@Data
@Document(indexName = "product")
public class SkuEsDoc {
    @Id
    private Long skuId;
    @Field(type = FieldType.Long)
    private Long spuId;
    @Field(type = FieldType.Text)
    private String skuTitle;
    @Field(type = FieldType.Keyword)
    private BigDecimal skuPrice;
    @Field(type = FieldType.Keyword, index = false)
    private String skuImg;
    @Field(type = FieldType.Long)
    private Long saleCount;
    @Field(type = FieldType.Boolean)
    private Boolean hasStock;
    @Field(type = FieldType.Long)
    private Long hotScore;
    @Field(type = FieldType.Long)
    private Long brandId;
    @Field(type = FieldType.Long)
    private Long catalogId;
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String brandName;
    @Field(type = FieldType.Keyword, index = false)
    private String brandImg;
    @Field(type = FieldType.Keyword)
    private String catalogName;

    @Field(type = FieldType.Nested)
    private List<Attrs> attrs;

}
